package com.honeycomb.service.impl;

import java.util.ArrayList;
import java.util.List;

import com.honeycomb.db.entity.ArticleInfo;
import com.honeycomb.service.BaseService;
import com.honeycomb.service.IMapService;
import com.honeycomb.utils.SystemConstants;
import com.honeycomb.vo.ArticleinfoVO;
import com.honeycomb.vo.BaseVO;
import com.honeycomb.vo.ResultDto;
import com.honeycomb.vo.action.map.AjaxMapForGetArticleRoundPointVO;

public class MapServiceImpl extends BaseService implements IMapService {

	public ResultDto getArticleinfoVOListByMapPoint(double x, double y, int distance, int pageNum) {
		ResultDto rd = new ResultDto();
		AjaxMapForGetArticleRoundPointVO amfgarpv = new AjaxMapForGetArticleRoundPointVO();
		
		List<ArticleinfoVO> aivl = new ArrayList<ArticleinfoVO>();
		List<ArticleInfo> ail = this.getiMapinfoDao().getArticleinfoListByMapPoint(x, y, distance, pageNum);
		for (int i = 0; i < ail.size(); i++) {
			ArticleInfo ai = ail.get(i);
			ArticleinfoVO aiv = new ArticleinfoVO();
			aiv.setArticleId(ai.getArticleId());
			aiv.setArticleTitle(ai.getArticleTitle());
			aiv.setArticleContent(ai.getArticleContent());
			aiv.setArticleCreateDttm(ai.getArticleCreateDttm());
			aiv.setArticleCreateIp(ai.getArticleCreateIp());
			aiv.setArticleVisitCnt(ai.getArticleVisitCnt());
			aiv.setArticleReplyCnt(ai.getArticleReplyCnt());
			aiv.setArticleLastReplyId(ai.getArticleLastReplyId());
			aiv.setArticleStatus(ai.getArticleStatus());
			aiv.setArticleSeq(ai.getArticleSeq());
			aiv.setMapInfo(ai.getMapInfo());
			aivl.add(aiv);
		}
		amfgarpv.setAivl(aivl);
		
		int totalCount = this.getiMapinfoDao().getArticleinfoListByMapPoint_Count(x, y, distance);
		amfgarpv.setTotleCount(totalCount);
		
		rd.setSuccess(true);
		rd.addToResultList(amfgarpv);
		return rd;
	}

}
